import { BasicColumn, FormSchema } from '@apps/antd-admin/src/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '支付Id',
    dataIndex: 'payInfoId',
    width: 180,
  },
  {
    title: '订单号',
    dataIndex: 'orderNo',
    width: 140,
  },
  {
    title: '支付金额',
    dataIndex: 'amount',
    width: 100,
  },
  {
    title: '支付类型',
    dataIndex: 'payType',
    width: 100,
    customRender: ({ record }: Recordable) => {
      const payTypeArray = [
        { label: '迅联微信', value: 'PAY_WX' },
        { label: '易宝微信', value: 'PAY_WX_YIBAO' },
        { label: '银联微信', value: 'PAY_WX_YINLIAN' },
        { label: '支付宝', value: 'PAY_ALI' },
        { label: '线下', value: 'PAY_UNDERLINE' },
        { label: '公司余额', value: 'PAY_COMPANY_BALANCE' },
        { label: '扫码支付', value: 'PAY_QRCODE' },
      ];
      const payType: any = payTypeArray.find(item => item.value == record.payType);
      if (payType) {
        return payType.label;
      }
      return '';
    },
  },
  {
    title: '支付状态',
    dataIndex: 'payStatus',
    width: 100,
    customRender: ({ record }: Recordable) => {
      const payStatusArray = [
        { label: '未支付', value: 'PAY_0' },
        { label: '已支付', value: 'PAY_1' },
        { label: '已退款', value: 'PAY_2' },
      ];
      const payStatus: any = payStatusArray.find(item => item.value == record.payStatus);
      if (payStatus) {
        return payStatus.label;
      }
      return '';
    },
  },
  {
    title: '付款日期',
    dataIndex: 'payDate',
    width: 150,
  },
  {
    title: '创建日期',
    dataIndex: 'createTime',
    width: 150,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'orderNo',
    label: '订单号',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'startDate',
    label: '开始日期',
    component: 'DatePicker',
    colProps: { span: 6 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    field: 'endDate',
    label: '结束日期',
    component: 'DatePicker',
    colProps: { span: 6 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    field: 'payType',
    label: '支付类型',
    component: 'Select',
    colProps: { span: 6 },
    componentProps: {
      options: [
        { label: '迅联微信', value: 'PAY_WX' },
        { label: '易宝微信', value: 'PAY_WX_YIBAO' },
        { label: '银联微信', value: 'PAY_WX_YINLIAN' },
        { label: '线下支付', value: 'PAY_UNDERLINE' },
        { label: '公司余额', value: 'PAY_COMPANY_BALANCE' },
        { label: '扫码支付', value: 'PAY_QRCODE' },
      ],
    },
  },
];
